using System;
namespace Framework
{
    public class HttpResult
    {
        public string url;
        public bool Finished { get; private set; }
        public bool Error { get; private set; }
        public string Text
        {
            get
            {
                if (Bytes == null) return null;
                return System.Text.Encoding.UTF8.GetString(Bytes);
            }
        }
        public byte[] Bytes { get; private set; }

        public void Clear()
        {
            Error = true;
            Bytes = null;
            Finished = false;
            url = null;
        }
        public void Set(bool error, byte[] data = null)
        {
            Finished = true;
            this.Error = error;
            if (data != null)
            {
                this.Bytes = data;
            }
            else
            {
                this.Bytes = null;
            }

        }
    }
}